package 第5章多线程编程作业.Work1.Work2;

import enum2.num;

public class Climb implements Runnable{
    static int num1=1;
    static int num2=1;
    public void run() {
        for (int i = 0; i <1000 ; i+=100) {
            if (Thread.currentThread().getName()=="年轻人"){
                System.out.println(Thread.currentThread().getName()+"爬了第"+num1+++"个100米");
                if (num1==11){
                    System.out.println("年轻人到达山顶");
                }
            }
            if (Thread.currentThread().getName()=="老年人"){
                System.out.println(Thread.currentThread().getName()+"爬了第"+num2+++"个100米");
                if (num2==11){
                    System.out.println("老年人到达山顶");
                }
            }
        }
    }
}
